(simple_search): In the loop of backward searching,
authorKenichi Handa <handa@m17n.org>
Fri, 17 Nov 2006 12:12:05 +0000 (12:12 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 17 Nov 2006 12:12:05 +0000 (12:12 +0000)
check also the byte position against the limit.

src/search.c

index 7c3151b76b8475df0bd7c161be0542c9e767f35a..d6572c5397a830795ae52d5b994d65ce171f6db2 100644 (file)
@@ -1514,7 +1514,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
            int this_len_byte = len_byte;
            unsigned char *p = pat;
 
-           if (pos - len < lim)
+           if (this_pos < lim || this_pos_byte < lim_byte)
              goto stop;
 
            while (this_len > 0)